import { injectable, unmanaged } from "inversify";
import { DiagnosticSeverity } from "vscode";
import { IDisposable, IDisposableRegistry, Resource } from "../../common/types";
import { IServiceContainer } from "../../ioc/types";
import { DiagnosticCodes, DiagnosticScope, IDiagnostic, IDiagnosticFilterService, IDiagnosticsService } from "./types";

@injectable()
export abstract class BaseDiagnostic implements IDiagnostic {
    constructor(
        public readonly code: DiagnosticCodes,
        public readonly message: string,
        public readonly severity: DiagnosticSeverity,
        public readonly scope: DiagnosticScope,
        public readonly resource: Resource,
        public readonly invokeHandler: 'always' | 'default' = 'default',
        public readonly shouldShowPrompt = true,
    ) {}
}


@injectable()
export abstract class BaseDiagnosticsService implements IDiagnosticsService, IDisposable {
    protected static handledDiagnosticCodeKeys: string[] = [];
    protected readonly filterService: IDiagnosticFilterService;
    constructor(
        @unmanaged() private readonly supportedDiagnosticCodes: string[],
        @unmanaged() protected serviceContainer: IServiceContainer,
        @unmanaged() disposableRegistry: IDisposableRegistry,
        @unmanaged() public readonly runInBackground: boolean = false,
        @unmanaged() public readonly runInUntrustedWorkspace: boolean = false,
    ) {
        this.filterService = serviceContainer.get<IDiagnosticFilterService>(IDiagnosticFilterService);
        disposableRegistry.push(this);
    }
    diagnose(resource: Resource): Promise<IDiagnostic[]> {
        throw new Error("94Method not implemented.");
    }
    canHandle(diagnostic: IDiagnostic): Promise<boolean> {
        throw new Error("95Method not implemented.");
    }
    handle(diagnostics: IDiagnostic[]): Promise<void> {
        throw new Error("96Method not implemented.");
    }
    dispose(): void | undefined {
        throw new Error("97Method not implemented.");
    }
}